#include <mathematics/Triangle.h>

namespace ne
{
    Triangle::Triangle(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2)
    {
        mVertex[0] = v0;
        mVertex[1] = v1;
        mVertex[2] = v2;
    }

    Triangle::Triangle(const Triangle &t)
    {
        mVertex[0] = t.mVertex[0];
        mVertex[1] = t.mVertex[1];
        mVertex[2] = t.mVertex[2];
    }

    Triangle& Triangle::operator = (const Triangle &t)
    {
        mVertex[0] = t.mVertex[0];
        mVertex[1] = t.mVertex[1];
        mVertex[2] = t.mVertex[2];
        return *this;
    }

    void Triangle::redefine(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2)
    {
        mVertex[0] = v0;
        mVertex[1] = v1;
        mVertex[2] = v2;
    }

    Vector2& Triangle::operator [] (const size_t v)
    {
        assert(v < 3);
        return mVertex[v];
    }

    const Vector2& Triangle::operator [] (const size_t v) const
    {
        assert(v < 3);
        return mVertex[v];
    }

    real* Triangle::ptr()
    {
        return mVertex[0].ptr();
    }

    const real* Triangle::ptr() const
    {
        return mVertex[0].ptr();
    }

    GeometryClass Triangle::getClass() const
    {
        return GC_TRIANGLE;
    }

    Triangle::~Triangle()
    {
    }
}
